<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<style>
		*{
			margin: 0;
			padding: 0;
		}
		video{
			background: #000000;
			float: left;
		}
	</style>
</head>
<body>
	<button id="q1">切换1</button>
	<button id="ddd">删除重新创建</button>
	<button id="dddd">删除</button>
	<section>
			<video id="player" controls="controls" width="500" height="300"  autoplay></video>
	</section>
	<section>
		<video id="player2" controls="controls" width="500" height="300" muted autoplay></video>
	</section>
</body>
<script src="/assets/index.js"></script>
<script type="text/javascript">
	// mp4 http://cdn.toxicjohann.com/lostStar.mp4
	// hls http://yunxianchang.live.ujne7.com/vod-system-bj/44_176_20170224113626af3a75cd-3508-4bc3-b51f-366fca3c7e39.m3u8
	// flv直播 http://pf.live.360vcloud.net/live_customers3/6818c55761856069a0ce
	// flv直播 http://flv.jia.360.cn/live_jia_public/_LC_RE_non_3605375765815007736131516144_BX.flv
	// flv点播 http://yunxianchang.live.ujne7.com/vod-system-bj/TL1ce1196bce348070bfeef2116efbdea6.flv
	// flv点播 http://yunxianchang.live.ujne7.com/vod-system-bj/TL2791e64b69ea0bea234c284c694986aa.flv
	// flv点播大文件 http://yunxianchang.live.ujne7.com/vod-system-bj/114_40402c0cbbe-5eba-42dc-8442-e6e09aa4152e.flv
	// 单视频案例 http://yunxianchang.live.ujne7.com/vod-system-bj/116_4102574c430-9c70-48c2-9123-fb8aa9a577c3.flv
	window.aaaa = 0;
	var player = document.querySelector('#player');
	var ddd = document.querySelector('#ddd');
	var button1 = document.querySelector('#q1');
	var button2 = document.querySelector('#q2');
	var Kernel1 = null;
	var Kernel2 = null;
	// player.addEventListener('loadedmetadata', function() {
	// 	Kernel1.seek(100);
	// })
	// player2.addEventListener('loadedmetadata', function() {
	// 		Kernel2.seek(100);
	// })
	function a () {
		Kernel1 = new chimeeKernelFlv(player, {
			src: 'ws://127.0.0.1:8576',
			box: 'flv',
			isLive: false,
			webWorker: false,
			seekType: 'range',
			stashSize: 1024 * 64
		});
		Kernel1.on('mediaInfo', function(mediainfo) {
			console.log(mediainfo);
		})
		Kernel1.load();
		

		Kernel1.on('error', function(errnomessage) {
			console.log(errnomessage.data);
		})
		Kernel1.on('heartbeat', function(msg) {
			// console.log(msg.data);
		})
	}
	
	a();

	ddd.onclick = function() {
		Kernel1.stopLoad();
		Kernel1.destroy();
		a();
	}

	dddd.onclick = function() {
		Kernel1.stopLoad();
		Kernel1.destroy();
		Kernel1 = null;
	}
</script>
</html>
